﻿using System;
using System.Collections.Generic;
using System.Text;

using Pacman.Simulator;
using Pacman.Simulator.Ghosts;

namespace PacmanAI
{
    public class monkeyFritterAI : BasePacman
    {
        public monkeyFritterAI() : base("monkeyFritterAI") { }

        public override Direction Think(GameState gs)
        {
            aStar path = new aStar();
            InfluenceMap im = new InfluenceMap();

            int pmx = gs.Pacman.Node.X;
            int pmy = gs.Pacman.Node.Y;

            im.updateMap(gs);
            im.calculateSectorValues();

            path.setInfluenceMap(im.getInfluenceMap());
            int[] firstNode = path.returnFirst(gs.Pacman.Node.X, gs.Pacman.Node.Y, im.returnTopSectorsValues(3));


            if (firstNode[0] == -1) return Direction.None;
            if (pmx < firstNode[0]) return Direction.Right;
            if (pmx > firstNode[0]) return Direction.Left;
            if (pmy > firstNode[1]) return Direction.Up;
            if (pmy < firstNode[1]) return Direction.Down;


            return Direction.None;
        }
    }     
}
